function initHtmlSelect(projectId, functionId, fieldId, caseId) {

	// if(!!projectId){//存在projectId
	ajaxSelectData(
			ctx + "/system/selenium/ajax/project",
			"projectId",
			projectId,
			function() {
				if (functionId || functionId == "") {// 如果有functionId
					if (projectId == "") {
						initSelectData("functionId");
						initSelectData("fieldId");
						initSelectData("caseId");
						form.render('select');
						return false;
					}
					ajaxSelectData(
							ctx + "/system/selenium/ajax/function?projectId="
									+ projectId,
							"functionId",
							functionId,
							function() {
								// debugger;
								if (fieldId || fieldId == "") {// 如果有fieldId

									if (functionId == "") {
										initSelectData("fieldId");
										initSelectData("caseId");
										form.render('select');
										return false;
									}

									ajaxSelectData(
											ctx
													+ "/system/selenium/ajax/field?projectId="
													+ projectId
													+ "&functionId="
													+ functionId,
											"fieldId",
											fieldId,
											function() {
												if (caseId || caseId == "") {// 如果有caseId

													if (fieldId == "") {
														initSelectData("caseId");
														form.render('select');
														return false;
													}

													ajaxSelectData(
															ctx
																	+ "/system/selenium/ajax/case?projectId="
																	+ projectId
																	+ "&functionId="
																	+ functionId
																	+ "&fieldId="
																	+ fieldId,
															"caseId", caseId,
															function() {
															});
												}
											});
								}
							});
				}
			});
	// }

}

function initLoginSelect(projectId, loginId) {
	if (loginId == "") {
		ajaxSelectData(ctx + "/system/selenium/ajax/login?projectId="
				+ projectId, "loginId");
	} else {
		ajaxSelectData(ctx + "/system/selenium/ajax/login?projectId="
				+ projectId, "loginId", loginId);
	}

}

function ajaxSelectData(_url, _selectId, _defaultValue, _fun) {

	jQuery.ajax({
		type : "POST",
		url : _url,
		dataType : "json",
		success : function(data) {
			initSelectData(_selectId);
			jQuery.each(data, function(index, value) {
				jQuery("#" + _selectId).append(
						'<option value="' + value["id"] + '">' + value["name"]
								+ '</option>');
			});
			if (_defaultValue) {
				jQuery("#" + _selectId).val(_defaultValue);
			}

			if (_fun) {
				_fun();
			}
			form.render('select');

		}
	});

}

function initSelectData(_selectId) {
	if (!jQuery("#" + _selectId)) {
		return;
	}
	jQuery("#" + _selectId).empty();
	jQuery("#" + _selectId).append('<option value="">==请选择==</option>');
}



//新增页面,初始化排序

function initSortno(_url){
	
	var _id=jQuery("#id").val();
	if(_id!=""){//不是新增页面
		return;
	}

	
	jQuery.ajax({
		type : "POST",
		url : _url,
		dataType : "json",
		success : function(data) {
		   if(!data){
			   return;
		   }
		   jQuery("#sortno").val(data);

		}
	});
}


